package com.order.controller.back_end;


import cn.hutool.core.util.StrUtil;
import com.order.common.AuthAccess;
import com.order.dao.Result;
import com.order.dao.User;
import com.order.service.UserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;



@Slf4j
@RestController
@Scope("prototype")
@AllArgsConstructor
public class UserController {

    private  UserService userService;

    @AuthAccess
    @RequestMapping ("/login")
    public Result login(@RequestBody  User user){

        if(StrUtil.isBlank(user.getUsername()) || StrUtil.isBlank(user.getPassword())){
            return Result.error(" 数据输入不合法");
        }
        user = userService.user_login(user);
        return Result.success(user);

    }





}
